//package mfcc.monkeyfly.net.base;
//
//import android.content.Context;
//import android.content.SharedPreferences;
//import android.os.Bundle;
//import android.support.annotation.Nullable;
//import android.support.v7.app.AppCompatActivity;
//import android.text.format.DateUtils;
//
//import com.handmark.pulltorefresh.library.ILoadingLayout;
//import com.handmark.pulltorefresh.library.PullToRefreshBase;
//import com.handmark.pulltorefresh.library.PullToRefreshListView;
//
//import java.text.DateFormat;
//import java.text.SimpleDateFormat;
//import java.util.Date;
//import java.util.concurrent.TimeUnit;
//
//import mfcc.monkeyfly.net.R;
//import mfcc.monkeyfly.net.base.loadingprogress.ProgressHelper;
//import mfcc.monkeyfly.net.service.ApiService;
//import okhttp3.OkHttpClient;
//import okhttp3.logging.HttpLoggingInterceptor;
//import retrofit2.Retrofit;
//import retrofit2.converter.gson.GsonConverterFactory;
//
///**
// * Created by Duke on 2016/8/30.
// */
//public abstract class BaseActivity extends AppCompatActivity {
//    String url = "https://apitest.monkeyfly.net/CKCRM/api/CKCRMLogin/Post";
//    public final static String BASE_URL = "https://apitest.monkeyfly.net/MFCC/";
//    public final static String TEST_URL = "https://apitest.monkeyfly.net/MFCC/api/";
//    public static final String TOKEN = "Token";
//
//    protected Context context;
//    protected ApiService apiService;
//
//    @Override
//    protected void onCreate(@Nullable Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        context = this;
//        setContentView(getLayoutId());
//        initRetrofit();
//        initView();
//        initData();
//        setOnClickListener();
//    }
//
//    public void LoadLayoutTime(PullToRefreshListView listView) {
//        String Time = DateUtils.formatDateTime(context, System.currentTimeMillis(),
//                DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL);
//        listView.getLoadingLayoutProxy().setLastUpdatedLabel(getString(R.string.LastTime) + Time);
//    }
//
//    public void initLoadLayout(PullToRefreshListView listView) {
//        listView.setMode(PullToRefreshBase.Mode.BOTH);
//        ILoadingLayout startLayout = listView.getLoadingLayoutProxy(true, false);
//        startLayout.setPullLabel(getString(R.string.pull_to_refresh));
//        startLayout.setRefreshingLabel(getString(R.string.loading_pull));
//        startLayout.setReleaseLabel(getString(R.string.refresh));
//        ILoadingLayout endLayout = listView.getLoadingLayoutProxy(false, true);
//        endLayout.setPullLabel(getString(R.string.LoadMoreTableFooterView));
//        endLayout.setRefreshingLabel(getString(R.string.Let_go_of_the_load));
//        endLayout.setReleaseLabel(getString(R.string.refresh));
//    }
//
//    //初始化retrofit
//    public void initRetrofit() {
//        Retrofit.Builder builder = new Retrofit.Builder();
//        HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
//        logging.setLevel(HttpLoggingInterceptor.Level.BODY);
//        //添加进度条
//        OkHttpClient.Builder okHttpBuilder = ProgressHelper.addProgress(null);
//        okHttpBuilder.interceptors().add(logging);
//        OkHttpClient client = okHttpBuilder.build();
//        okHttpBuilder.connectTimeout(10, TimeUnit.SECONDS);
//        builder.baseUrl(TEST_URL);
//        builder.client(client);
//        builder.addConverterFactory(GsonConverterFactory.create());
//        Retrofit retrofit = builder.build();
//        apiService = retrofit.create(ApiService.class);
//    }
//
//    //获取SharePreference中的Token
//    public String getToken() {
//        SharedPreferences sp = getSharedPreferences(TOKEN, MODE_PRIVATE);
//        return sp.getString("Token", null);
//    }
//    //获取用户类型
//    public String getType() {
//        SharedPreferences sp = getSharedPreferences(TOKEN, MODE_PRIVATE);
//        return sp.getString("Type", null);
//    }
//    //获取用户名字
//    public String getName() {
//        SharedPreferences sp = getSharedPreferences(TOKEN, MODE_PRIVATE);
//        return sp.getString("Name", null);
//    }
//    //获取头像地址
//    public String getLogo() {
//        SharedPreferences sp = getSharedPreferences(TOKEN, MODE_PRIVATE);
//        return sp.getString("Logo", null);
//    }
//    //获取号码
//    public String getAccount() {
//        SharedPreferences sp = getSharedPreferences(TOKEN, MODE_PRIVATE);
//        return sp.getString("Account", null);
//    }
//    //获取性别
//    public boolean getSex() {
//        SharedPreferences sp = getSharedPreferences(TOKEN, MODE_PRIVATE);
//        return sp.getBoolean("Sex",true);
//    }
//    //获取签名
//    public String getSignature() {
//        SharedPreferences sp = getSharedPreferences(TOKEN, MODE_PRIVATE);
//        return sp.getString("Signature", null);
//    }
//
//
//
//    public String getCurrentTime() {
//        Date date = new Date();
//        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        String time = format.format(date);
//        return time;
//    }
//    public String getCurrentTimeYear() {
//        Date date = new Date();
//        DateFormat format = new SimpleDateFormat("yyyy");
//        String time = format.format(date);
//        return time;
//    }
//    public String getCurrentTimeMonth() {
//        Date date = new Date();
//        DateFormat format = new SimpleDateFormat("MM");
//        String time = format.format(date);
//        return time;
//    }
//    public String getCurrentTimeDay() {
//        Date date = new Date();
//        DateFormat format = new SimpleDateFormat("dd");
//        String time = format.format(date);
//        return time;
//    }
//
//    protected abstract int getLayoutId();
//
//    protected abstract void initView();
//
//    protected abstract void initData();
//
//    protected abstract void setOnClickListener();
//}
